<template>
      <div id="wrapper">
          <!--使用子组件-->
          <home-header></home-header>
          <home-swiper :imgUrl="swiperList"></home-swiper>
          <home-icons :icons="iconsList"></home-icons>
          <home-other :hotbdan="hotbdan" :yLikeData="yLikeData"></home-other>
          <home-week :weekData="weekList"></home-week>
          <home-footer></home-footer>
      </div>
</template>
<script>
   //引入组件
   import HomeHeader from '@/pages/home/components/Header'
   import HomeSwiper from '@/pages/home/components/Swiper'
   import HomeIcons from '@/pages/home/components/Icons'
   import HomeOther from '@/pages/home/components/Other'
   import HomeWeek from '@/pages/home/components/Week'
   import HomeFooter from '@/pages/home/components/Footer'
   //请求数据
   import axios from 'axios'

    export default {
        name: "Home",
        components:{//注册组件
          HomeHeader,
          HomeSwiper,
          HomeIcons,
          HomeOther,
          HomeWeek,
          HomeFooter
        },
        data () {//数据
             return {
              // city:"",
               swiperList:[],
               iconsList:[],
               hotbdan:[],
               yLikeData:[],
               weekList:[]
             }
        },
        methods:{
           getHomeInfo(){
             //请求数据
             axios.get('static/moke/index.json').then(this.getSucc)
           },
           getSucc(res){//对数据进处理
              var res=res.data;//请求的结果

             if(res.ret && res.data){
            //    this.city=res.data.city;//Header中的city
                this.swiperList=res.data.imgUrl //swiper的数据
                this.iconsList=res.data.iconsUrl //icons 的数据
                this.hotbdan=res.data.hotbdan
                this.yLikeData=res.data.yLikeData
                this.weekList=res.data.weekList
             }
           }
        },
        mounted(){//生命周期钩子  (一般向后端发起请求，对请求的数据做业务处理)
           this.getHomeInfo();
        }
    }
</script>

<style lang="stylus" scoped>
   #wrapper{

   }
</style>
